import request from '@/utils/request'

// 查询所有领料信息
export function selectAll() {
  return request({
    url: '/TakeMaterial/requisition-header/selectAll1',
    method: 'get'
  })
}

// 按照领料编号查找领取物品
export function SelectById(requisitionId) {
  return request({
    url: '/TakeMaterial/material-requisition/selectById',
    method: 'get',
    params: {
      requisitionId: requisitionId
    }
  })
}

// 按照验收流水号查找物料信息
export function SelectByAccId(acceptId) {
  return request({
    url: '/entryWarehouse/accept-goods/selectById',
    method: 'get',
    params: {
      acceptId: acceptId
    }
  })
}

// 审核通过
export function unitPassed(requisitionId) {
  return request({
    url: '/TakeMaterial/requisition-header/unitPassed',
    method: 'post',
    params: {
      requisitionId: requisitionId
    }
  })
}
// 审核失败
export function unitFailed(requisitionId) {
  return request({
    url: '/TakeMaterial/requisition-header/unitFailed',
    method: 'post',
    params: {
      requisitionId: requisitionId
    }
  })
}

// 删除申请物品
export function removeMater(id) {
  return request({
    url: '/TakeMaterial/material-requisition/removeMater',
    method: 'post',
    params: {
      id: id
    }
  })
}

// 更新申请物品的数量
export function editMater(id, requisitionId, name, specification, unit, dueNum, actualNum, price, tax, reamrk) {
  return request({
    url: '/TakeMaterial/material-requisition/editMater',
    method: 'post',
    data: {
      id: id,
      requisitionId: requisitionId,
      name: name,
      specification: specification,
      unit: unit,
      dueNum: dueNum,
      actualNum: actualNum,
      price: price,
      tax: tax,
      reamrk: reamrk
    }
  })
}
